@import 'mixins_and_variables_and_functions';

$tabs-holder-z-index: 250;
$comparison-empty-state-height: 62px;

.space-children {
  @include clearfix;

  > * {
    float: left;
  }

  > *:not(:first-child) {
    margin-left: 10px;
  }
}

.media-section {
  @include media-breakpoint-down(md) {
    align-items: flex-start;

    .media-body {
      flex-direction: column;
      align-items: flex-start;
    }
  }

  .code-text {
    @include media-breakpoint-up(lg) {
      align-self: center;
      flex: 1;
    }
  }
}

.mr_source_commit,
.mr_target_commit {
  margin-bottom: 0;

  .commit {
    margin: 0;
    padding: 10px;
    list-style: none;

    &:hover {
      background: none;
    }
  }
}

.compare-commit-empty {
  min-height: $comparison-empty-state-height;
}

.commits-empty {
  text-align: center;

  h4 {
    padding-top: 20px;
    padding-bottom: 10px;
  }

  svg {
    width: 230px;
  }
}

.nothing-here-block {
  img {
    width: 230px;
  }
}

.mr-list {
  .merge-request {
    padding: 10px $gl-padding;
    display: flex;

    .issuable-info-container {
      flex: 1;
    }

    .merge-request-title {
      margin-bottom: 2px;

      .ci-status-link {
        svg {
          height: 16px;
          width: 16px;
          position: relative;
          top: 3px;
        }

        &:hover,
        &:focus {
          text-decoration: none;
        }
      }
    }
  }
}

.card-new-merge-request {
  .card-header {
    padding: 5px 10px;
    font-weight: $gl-font-weight-bold;
    line-height: 25px;
  }

  .card-body {
    padding: 10px 5px;
  }

  .card-footer {
    padding: 0;

    .btn {
      min-width: auto;
    }
  }

  .commit {
    .commit-row-title {
      margin-bottom: 4px;
    }

    .item-title {
      @include media-breakpoint-up(sm) {
        width: 45%;
      }
    }

    .avatar {
      left: 0;
      top: 2px;
    }
  }

  .btn-clipboard {
    margin-right: 5px;
    padding: 0;
    background: transparent;
  }

  .ci-status-link {
    margin-right: 5px;
  }
}

.merge-request-select {
  padding-left: 5px;
  padding-right: 5px;
  margin-bottom: 10px;

  &:last-child {
    margin-bottom: 0;
  }

  @include media-breakpoint-up(xs) {
    float: left;
    width: 50%;
    margin-bottom: 0;
  }

  .gl-dropdown-custom-toggle {
    @include gl-w-full;
  }
}

.issuable-form-select-holder {
  display: inline-block;
  width: 100%;

  @include media-breakpoint-up(md) {
    width: 250px;
  }

  .dropdown-menu-toggle {
    width: 100%;
  }
}

.issuable-form-label-select-holder .gl-dropdown-toggle {
  @include media-breakpoint-up(md) {
    width: 250px;
  }
}

.table-holder {
  .ci-table {
    th {
      background-color: var(--white, $white);
      color: var(--gl-gray-700, $gl-text-color-secondary);
    }
  }
}

.merge-request-tabs-holder {
  top: $calc-application-header-height;
  z-index: $tabs-holder-z-index;
  background-color: var(--gray-10, $body-bg);
  border-bottom: 1px solid var(--border-color, $border-color);

  @include media-breakpoint-up(md) {
    position: sticky;
  }

  &.affix {
    left: 0;
    transition: right 0.15s;

    @include media-breakpoint-down(xs) {
      right: 0;
    }
  }

  .nav-links {
    border: 0;
  }
}

.limit-container-width {
  .merge-request-tabs-container {
    max-width: $limited-layout-width;
    margin-left: auto;
    margin-right: auto;

    .inner-page-scroll-tabs {
      background-color: var(--white, $white);
      margin-left: -$gl-padding;
      padding-left: $gl-padding;
    }
  }
}

.merge-request-tabs-container {
  @include media-breakpoint-down(xs) {
    .discussion-filter-container {
      margin-bottom: $gl-padding-4;
    }
  }

  .discussion-filter-container {
    &:not(:only-child) {
      margin: $gl-padding-4;
    }
  }

  .merge-request-tabs {
    height: $grid-size * 6;
  }
}

.container-fluid {
  // Negative margins for mobile/tablet screen
  .diffs.tab-pane {
    margin: 0 (-$gl-padding);
  }
}

// Wrap MR tabs/buttons so you don't have to scroll on desktop
@include media-breakpoint-down(md) {
  .merge-request-tabs-container {
    flex-direction: column-reverse;
  }
}

@include media-breakpoint-down(lg) {
  .right-sidebar-expanded {
    .merge-request-tabs-container {
      flex-direction: column-reverse;
      align-items: flex-start;
    }
  }
}

.limit-container-width:not(.container-limited) {
  .merge-request-tabs-holder .merge-request-tabs-container {
    max-width: $limited-layout-width - ($gl-padding * 2);
  }
}

.fork-sprite {
  margin-right: -5px;
}

// Hack alert: we've rewritten `btn` class in a way that
// we've broken it and it is not possible to use with `btn-link`
// which causes a blank button when it's disabled and hovering
// The css in here is the boostrap one
.btn-link-retry {
  &[disabled] {
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.65;

    &:hover {
      color: var(--gray-500, $gray-500);
      text-decoration: none;
    }
  }
}

.merge-request-details .file-finder-overlay.diff-file-finder {
  position: fixed;
  z-index: 99999;
  background: $black-transparent;
}

.mr-compare {
  .diff-file .file-title-flex-parent {
    top: calc(#{$calc-application-header-height} + #{$mr-tabs-height});
  }
}

.mr-experience-survey-wrapper {
  // setting this explicitly because:
  //   diff-files-holder has z-index 203
  //   z-index 9999 utility class breaks tooltips
  z-index: 210;
}

.mr-experience-survey-body {
  width: 300px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mr-experience-survey-legal {
  order: 1;
}

.mr-experience-survey-logo {
  width: 16px;

  svg {
    max-width: 100%;
  }
}

.survey-slide-up-enter {
  transform: translateY(10px);
  opacity: 0;
}

.survey-slide-up-enter-active {
  @include gl-transition-slow;
}

.mr-compare-dropdown {
  @include gl-w-full;

  .gl-button-text {
    @include gl-w-full;
  }
}
